<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('mjzj_reviewers', function (Blueprint $table) {
            $table->id();
            $table->string('reviewer_id')->unique()->comment('评论者唯一标识');
            $table->string('name')->comment('评论者姓名');
            $table->string('avatar')->nullable()->comment('头像URL');
            $table->string('platform')->nullable()->comment('平台名称');
            $table->string('country')->nullable()->comment('国家');
            $table->decimal('rating', 3, 2)->default(0)->comment('评分');
            $table->integer('review_count')->default(0)->comment('评论数量');
            $table->bigInteger('follower_count')->default(0)->comment('粉丝数量');
            $table->string('email')->nullable()->comment('邮箱');
            $table->text('contact_info')->nullable()->comment('联系方式');
            $table->text('description')->nullable()->comment('描述');
            $table->string('keywords')->nullable()->comment('关键词');
            $table->string('market')->nullable()->comment('市场');
            $table->decimal('exposure_score', 8, 2)->default(0)->comment('曝光分数');
            $table->timestamp('last_active')->nullable()->comment('最后活跃时间');
            $table->json('raw_data')->nullable()->comment('原始数据');
            $table->timestamps();
            $table->softDeletes();

            // 创建索引
            $table->index(['platform', 'country']);
            $table->index(['keywords']);
            $table->index(['market']);
            $table->index(['rating']);
            $table->index(['exposure_score']);
            $table->index(['created_at']);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('mjzj_reviewers');
    }
}; 